using System;

namespace Game.Core
{
    [Serializable]
    public unsafe struct MovePropertyData
    {
        public float CurEncumbered;
        public float MaxEncumbered;
        public float MoveSpeed;
        public float RotateSpeed;
        
        public static MovePropertyData operator +(MovePropertyData a) => a;

        public static MovePropertyData operator -(MovePropertyData a) =>
            new MovePropertyData()
            {
                CurEncumbered = -a.CurEncumbered,
                MaxEncumbered = -a.MaxEncumbered,
                MoveSpeed = -a.MoveSpeed,
                RotateSpeed = -a.RotateSpeed,
            };

        public MovePropertyData Add(MovePropertyData* p)
        {
            MovePropertyData r = new MovePropertyData();
            r.CurEncumbered = CurEncumbered + p->CurEncumbered;
            r.MaxEncumbered = MaxEncumbered + p->MaxEncumbered;
            r.MoveSpeed = MoveSpeed + p->MoveSpeed;
            r.RotateSpeed = RotateSpeed + p->RotateSpeed;
            return r;
        }
        public static MovePropertyData operator +(MovePropertyData a, MovePropertyData* b) => a.Add(b);
        public static MovePropertyData operator +(MovePropertyData a, MovePropertyData b) => a.Add(&b);
        public MovePropertyData Subtract(MovePropertyData* p) => this + -(*p); 
        public static MovePropertyData operator -(MovePropertyData a, MovePropertyData b) => a + (-b);
    }
}